{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "#programming_fever\n",
    "#pencil drawing effect using opencv\n",
    "import numpy as np\n",
    "import cv2\n",
    "\n",
    "img =\"E://OpenCV//elonobama.jpg\"\n",
    "img_obj = cv2.imread(img)\n",
    "\n",
    "\n",
    "\n",
    "dim = (width,height)\n",
    "resized = cv2.resize(img_obj,dim,interpolation = cv2.INTER_AREA)  \n",
    "\n",
    "kernel_sharpening = np.array([[-1,-1,-1], \n",
    "                              [-1, 9,-1],\n",
    "                              [-1,-1,-1]])\n",
    "sharpened = cv2.filter2D(resized,-1,kernel_sharpening)  \n",
    "\n",
    "\n",
    "gray = cv2.cvtColor(sharpened , cv2.COLOR_BGR2GRAY)   \n",
    "object_detection = cv2.cvtColor(sharpened, cv2.COLOR_BGR2HSV ) \n",
    "\n",
    "\n",
    "inv = 255-gray\n",
    "gauss = cv2.GaussianBlur(inv,ksize=(15,15),sigmaX=0,sigmaY=0) \n",
    "\n",
    "pencil = cv2.divide(gray,255-gauss,scale=256)\n",
    "\n",
    "cv2.imshow('resized',resized)\n",
    "cv2.imshow('sharp',sharpened)\n",
    "cv2.imshow(\"gray\", gray)\n",
    "cv2.imshow('pencil drawing',pencil)\n",
    "cv2.waitKey(0)\n",
    "cv2.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
